ConfigAction

class ConfigAction @JvmOverloads constructor(titleSupplier: Supplier<Text>, activeSupplier: Supplier<Boolean>, pressAction: Runnable, decoration: Decorated?, description: Text? = null, background: TextureSet? = null) : EntryWidget<Any> , EntryFlag, EntryCreator, EntryTransient, TranslatableEntry

Builds a button that will appear in a Config GUI, to perform some arbitrary, possible non-config-related action

This could be used to link to a wiki, open another non-fzzy-config config, open a non-config screen, open a patchouli guide, run a command, and so on.

Author

fzzyhmstrs

Since

0.5.0, Decorated and PressableTextures incorporated 0.6.0

Parameters

titleSupplier

Supplier - supplies a name for the button widget. Will be checked every frame, so the button name will dynamically update as needed.

activeSupplier

Supplier - supplies an active state; whether the button is inactive ("greyed out" and unclickable) or active (functioning normally)

pressAction

Runnable - the action to execute on clicking the button

background

Identifier, nullable - if non-null, will provide a custom background for the widget rendering.

decoration

Decorated, nullable - if non-null, will render a "decoration" next to the widget. These are the typically white/wireframe icons shown next to certain settings like lists.

Constructors

Link copied to clipboard
constructor(titleSupplier: Supplier<Text>, activeSupplier: Supplier<Boolean>, pressAction: Runnable, decoration: Identifier?, description: Text? = null, background: Identifier? = null)
constructor(titleSupplier: Supplier<Text>, activeSupplier: Supplier<Boolean>, pressAction: Runnable, decoration: Decorated?, description: Text? = null, background: TextureSet? = null)

Types

Link copied to clipboard
class Builder

Builds a ConfigAction

Functions

Link copied to clipboard
open override fun descriptionKey(): String

translation key of this Translatable's description. the "description" in-game, the descriptions Enchantment Descriptions adds to enchantment tooltips are a good example.

Link copied to clipboard
open fun flags(): Byte
Link copied to clipboard
open override fun getEntryKey(): String
Link copied to clipboard
open fun hasPrefix(): Boolean

Whether this Translatable has a valid prefix

Link copied to clipboard

Whether this Translatable has a valid translation

Link copied to clipboard
open fun prefix(fallback: String? = null): MutableText

The translated Text description from the descriptionKey. Falls back to an empty string so no tooltip is rendered.

Link copied to clipboard
open override fun prefixKey(): String

translation key of this Translatable's inline prefix text. Unlike descriptions, which are usually displayed in-tooltips, prefixes are displayed inline in the config screen itself

Link copied to clipboard
open fun prepare(scope: String, groups: LinkedList<String>, annotations: List<Annotation>, globalAnnotations: List<Annotation>)

Called in the prepare stage of screen building to perform any necessary pre-entry-creation tasks.

Link copied to clipboard
open override fun setEntryKey(key: String)
Link copied to clipboard
open fun translation(fallback: String? = null): MutableText

The translated Text name from the translationKey. Falls back to the implementing classes Simple Name (non-translated)

Link copied to clipboard
open override fun translationKey(): String

translation key of this Translatable. the "name" in-game

Link copied to clipboard
open fun widgetAndTooltipEntry(choicePredicate: ChoiceValidator<Any> = ChoiceValidator.any()): ClickableWidget

Builds a new ClickableWidget and applies a tooltip to it. This shouldn't need to be overridden in most cases